package cn.itcast.bos.web.action.system;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionContext;

import cn.itcast.bos.domain.system.Permission;
import cn.itcast.bos.service.system.PermissionService;
import cn.itcast.bos.web.action.common.BaseAction;

public class PermissionAction extends BaseAction<Permission>{
	@Resource
	private PermissionService service;
	
	@Action(value = "permission_list", results = { @Result(name = "success", type = "json") })
	public String permission_list(){
		List<Permission> list = service.findAll();
		ActionContext.getContext().getValueStack().push(list);
		return SUCCESS;
	}
	
	@Action(value = "permission_save", results = { @Result(name = "success", type = "redirect",location="pages/system/permission.html") })
	public String permission_save(){
		service.save(model);
		return SUCCESS;
	}
}
